Created: 2022-07-02
Tags: #fleeting
Abstract:
Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root and explores as far as possible along each branch before backtracking.
pre-order visit, left, right,
in-order left, visit, right,
post-order left, right, visit
Traversal means visiting all the nodes of a graph.
A standard DFS implementation puts each vertex of the graph into one of two categories:
The purpose of the algorithm is to mark each vertex as visited while avoiding cycles.
The DFS algorithm works as follows:
Breadth-first search is an algorithm for traversing or searching tree or graph structures. In level-order, where we visit every node on a level before going to a lower level.